<?php $objuser=$session->read('User');?>
<div class="right_side_operate_area">
    <div class="right_side_title left">
        <h2><?php echo $user['User']['name']; ?></h2>
        <div class="clear"></div>
    </div>
    <div class="right item_add_btn">
        <?php 
            $str_title=__("Edit",true);
            echo $html->link(__("Cancel",true).$str_title,"/users/index/");
        ?>
    </div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
<div class="detail_info_panel">
<?php echo $form->create('User', array('action' => 'edit','type'=> 'post','id' => 'form','name' => 'form','enctype'=>'multipart/form-data','onsubmit' => 'return checksave()') ); 
?>
    <div class="details_item_line">
        <div class="details_item">
            <div class="form_left_title left"><?php echo "头像" ?>：</div>
            <div class="form_right_e_input left">
            <?php 
            //if(!empty($logo)){
            //    $logoimg=$logo["file_path"];
            //    if($logoimg){
                  //  $logoimg=$user['User']['icon'];
                   // echo $html->image($logoimg,array("width"=>"40px","height"=>"40px")).'<br/>';
                    if($attachment['Attachment']['file_path']){
                   // echo $html->image("/".$attachment['Attachment']['file_path'],array("width"=>"40px","height"=>"40px")).'<br/>';;
                   	 ?>	
               		 <img alt="" src="../../showthumbnail.php?path=<?php echo base64_encode($attachment['Attachment']['file_path']);?>" style="width:40px; height:40px;" />
                	 <?php
                    }else{ echo $html->image('men_large.jpg',array("width"=>"40px","height"=>"40px")).'<br/>';; }
            //    }
            //}
            ?>
            <input type="file" id="upload" name="upload[]" />
            </div>
        </div>
    </div>
    <div class="details_item_line">
        <div class="details_item">
            <div class="form_left_title left"><?php __("Name")?>：</div>
            <div class="form_right_e_input left"><?php echo $form->text('User.name');?></div>
            <div id='namemessage' style='display:none;' class="error_message">请填写昵称！</div>
        </div>
    </div>
    <div class="details_item_line">
        <div class="details_item">
            <div class="form_left_title left"><?php __("Email")?>：</div>
            <div class="form_right_e_input left"><?php echo $form->text('User.email',array("maxlength"=>"50","style"=>"ime-mode:disabled"));?></div>
            <?php echo $form->text('User.uemail',array("class"=>"txthide","value"=>$form->value('User.email')));?>
            <div id='mailmessage' style='display:none;' class="error_message">请填写正确的邮箱地址！</div>
        </div>
    </div>
    <?php if($objuser["isadmin"]){?>
    <div class="details_item_line">
        <div class="details_item">
            <div class="form_left_title left"><?php __("Group")?>：</div>
            <div class="form_right_e_input left"><?php echo $form->select('User.groupid',$grouplist,null,null,null);?></div>
        </div>
        <?php echo $form->text('User.initgroupid',array("value"=>$form->value('User.groupid'),"class"=>"txthide"));?>
    </div>
    
    <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"></div>
                <div class="form_right_e_input left"><?php echo $form->checkbox('User.isgroupadmin');?><?php __("模块管理员")?></div>
            </div>
    </div>
    <?php }?>
    <div class="details_item_line">
        <div class="details_item">
            <div class="form_left_title left"><?php __("Position")?>：</div>
            <div class="form_right_e_input left"><?php echo $form->text('User.position');?></div>
        </div>
    </div>
    <div class="details_item_line">
        <div class="details_item">
            <div class="form_left_title left"><?php __("Tel")?>：</div>
            <div class="form_right_e_input left"><?php echo $form->text('User.mobile');?></div>
        </div>
    </div>
    <div class="details_item_line">
        <div class="details_item">
            <div class="form_left_title left"><?php __("Address")?>：</div>
            <div class="form_right_e_input left"><?php echo $form->text('User.address');?></div>
        </div>
    </div> 
    <?php if($objuser["isadmin"]){?>
    <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"></div>
                <div class="form_right_e_input left"><?php echo $form->checkbox('User.isadmin');?><?php __("系统管理员")?></div>
            </div>
    </div>
    <div class="details_item_line">
   		    <div class="details_item">
            	<div class="form_left_title left"></div>
             	<div class="form_right_e_input left"><?php echo $form->checkbox('User.isvisitor');?><?php __("高级访客")?></div>
            </div>
    </div>
        <div class="details_item_line">
   		    <div class="details_item">
            	<div class="form_left_title left"></div>
             	<div class="form_right_e_input left"><?php echo $form->checkbox('User.can_updata');?><?php __("同步数据权限")?></div>
            </div>
    </div>
    <?php }?>
    <div class="details_item_line">
        <div class="details_item">
           <div class="form_left_title left"></div>
            <div class="form_add_submit left">
                <?php echo $form->submit(__('Save',true), array("id"=>"adduser","name"=>"submit","class"=>"buttom","div"=>false));  ?>
            </div>
        </div>
    </div>
</form>
</div>
</div>
<script>
var webpath=$("#getpath").attr('href');
$(document).ready(function() {
    $("#UserEmail").blur(function() {  
        var mail=this.value;
        var umail=$("#UserUemail").val();
        checkuserbymail(webpath,mail,umail,"#mailmessage");
    }); 
});
function checksave(){
    if($("#mailmessage").css('display')=="block"){
        return false;
    }
    if($("#UserName").val().trim()==""){
        $("#namemessage").css('display','block');
        return false;
    }
}
</script>